package edu.usm.roberge.server.orbitz;

import java.util.List;

import edu.usm.roberge.server.HtmlChangedException;

/**
 * Composite request that will coordinate sending the 3 required requests to the
 * Orbitz website to gather the flight results
 */
public class OrbitzCompositeRequest {

	public List<String> getOrbitzPrices(String destinationCity) throws HtmlChangedException {
		OrbitzIndexRequest req = new OrbitzIndexRequest();
		OrbitzData data = req.getOrbitzData();
		OrbitzSubmissionRequest req2 = new OrbitzSubmissionRequest(data, destinationCity);
		data = req2.getResultData();
		
		try { // simulate the loading page
			Thread.sleep(2000);
		} catch (InterruptedException e) {
		}
		OrbitzResultRequest req3 = new OrbitzResultRequest(data);
		
		return req3.getSortedPrices();
	}
}
